﻿<UserControl x:Class="LINQPad.OpenAccess.UI.View.DriverSettingsView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:conv="clr-namespace:LINQPad.OpenAccess.UI.Converters"
             xmlns:local="clr-namespace:LINQPad.OpenAccess.UI.View"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
             MinWidth="600" MinHeight="400"
             d:DesignHeight="600" d:DesignWidth="400">
    <UserControl.Resources>
        <conv:NegateBooleanConverter x:Key="NegateBool" />
    </UserControl.Resources>
    <DockPanel Margin="2">
        <!-- commands -->
        <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Center">
            <Button Command="{Binding SaveCommand}" Margin="2 1">
                <StackPanel Orientation="Horizontal" Margin="2 0">
                    <Image Source="../Images/Save.png" Height="16" Width="16" />
                    <TextBlock Text="Save" Margin="4 0"/>
                </StackPanel>
            </Button>
            <Button Command="{Binding CancelCommand}" Margin="2 1" IsCancel="True" IsDefault="True">
                <StackPanel Orientation="Horizontal" Margin="2 0">
                    <Image Source="../Images/Cancel.png" Height="16" Width="16" />
                    <TextBlock Text="Cancel" Margin="4 0"/>
                </StackPanel>
            </Button>
        </StackPanel>
        <TabControl >
            <TabItem Header="basic settings">
                <AdornerDecorator>
                    <local:BasicSettingsView DataContext="{Binding BasicSettings}" />
                </AdornerDecorator>
            </TabItem>
            <TabItem Header="backend settings" 
                     IsEnabled="{Binding BasicSettings.UseDefaultConstructor, Converter={StaticResource NegateBool}}">
                <AdornerDecorator>
                    <local:BackendSettingsView DataContext="{Binding BackendSettings}" />
                </AdornerDecorator>
            </TabItem>
            <TabItem Header="connection settings" 
                     IsEnabled="{Binding BasicSettings.UseDefaultConstructor, Converter={StaticResource NegateBool}}">
                <AdornerDecorator>
                    <local:ConnectionSettingsHostView DataContext="{Binding ConnectionSettingsHost}" />
                </AdornerDecorator>
            </TabItem>
        </TabControl>
    </DockPanel>
</UserControl>
